﻿using Container;
using DAL;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Proba
{
    public class MainPresenter
    {
        private IMainView _view;
        private ShopContext _data;

        public MainPresenter(IMainView view, ShopContext data)
        {
            this._view = view;
            this._data = data;
            this._view.btn1Clicked += Button1Clicked;

        }

        private void Button1Clicked()
        {
            //_view.ProdName = _data._model;
            
            SetProductsToView();

        }

        private void SetProductsToView()
        {
            List<User> _usersfrombase = new List<User>();
            foreach (var en in _data.Users)
            {
                _usersfrombase.Add(en);
            }
            _view.huita = _usersfrombase;
            
            _view.huita =_data.Users.ToList<User>();
        }
        public void Run()
        {
            //SetProductCategoriesToTablecbx(GetAllCategories());
            this._view.Show();
        }
    }
}
